package com.zjj.jpa.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.zjj.jpa.entity.User;

public interface UserDao extends JpaRepository<User, Integer> {

	@Transactional
	@Modifying(clearAutomatically = true)
	@Query(value = "update User set name = ?1,age = ?2 where id = ?3")
	public int updateUserById(String name, Integer age, Integer id);
}
